<template>
  <div>
  <el-page-header  @back="$router.push('/returnregistration')" content="回单查看" class="huidan"></el-page-header>
  <el-card class="aaa">
    <el-row class="jibenxinxi">
      <span>基本信息</span>
    </el-row>
    <el-row type="flex" justify="space-around" style="font-size: 14px;">
      <el-col class="infos">运输任务编号：{{formData.transportTaskId}}</el-col>
      <el-col>车牌号码：{{formData.licensePlate}}</el-col>
      <el-col>起始地机构：{{formData.startAgencyName}}</el-col>
      <el-col>目的地机构：{{formData.endAgencyName}}</el-col>
    </el-row>
      <el-row type="flex" justify="space-around" class="info-two" style="font-size: 14px;">
        <el-col class="infos" >出车时间：{{formData.outStorageTime}}</el-col>
        <el-col>回车时间：{{formData.intoStorageTime}}</el-col>
        <el-col>司机：{{formData.driverName}}</el-col>
        <!-- 下面这行标签是为了隐藏才定义的 -->
        <el-col class="siji">司机：</el-col>
      </el-row>
  </el-card>
  <!-- 下半部分 -->
  <el-card>
     <el-row class="jibenxinxi">
      <span >异常信息</span>
    </el-row>
    <el-row type="flex" justify="space-around" style="height:60px">
      <el-col class="infos">车辆故障：{{isFault()}}</el-col>
      <el-col>车辆违章：{{isBreakRules()}}</el-col>
      <el-col>车辆事故：{{isAccident()}}</el-col>
    </el-row>
  </el-card>
  </div>
</template>

<script>
import { registerDetails } from '@/api/returnregistration'
export default {
  name: 'return-info',
  data () {
    return {
      formData: {},
      userId: this.$route.params.id // 拿到id
    }
  },
  methods: {
    async    getInfoType () {
      const res = await registerDetails(this.userId)
      console.log(res)
      this.formData = res.data
    },
    // 车辆事故数据处理
    isAccident () {
      if (this.formData.isAccident === false) {
        return '否'
      } else {
        return '是'
      }
    },
    // 车辆违章处理
    isBreakRules () {
      if (this.formData.isBreakRules === false) {
        return '否'
      } else {
        return '是'
      }
    },
    // 车辆故障处理
    isFault () {
      if (this.formData.isFault === false) {
        return '否'
      } else {
        return '是'
      }
    }

  },
  created () {
    this.getInfoType()
  }
}
</script>

<style lang="scss" scoped>
.huidan{
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}
.jibenxinxi {
    // font-size: 16px;
    font-weight: 700;
    background-color: #f8faff;
    margin-top: 0px;
    height: 60px;
    // background-color: rgb(248, 250, 255);
    padding: 20px 20px 20px 44px;
    margin-bottom: 8px;
    // justify-content: space-around;
}
.info-two{
  margin: 10px 0px;
  // margin-top: 10px;
}
.siji {
  visibility: hidden;
}
.infos {
  padding-left: 44px;
  // padding-top: 10px;
}
.aaa {
  margin-bottom: 20px;
}
</style>
